fix: Correctly query message on CreateUserTokenError union#3997
fix: Correctly query message on CreateUserTokenError union#3997sentry[bot] wants to merge 1 commit into
Conversation
Bundle ReportChanges will increase total bundle size by 112 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: gazebo-production-systemAssets Changed:
Files in
view changes for bundle: gazebo-production-esmAssets Changed:
Files in
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3997 +/- ##
=======================================
Coverage 98.73% 98.73%
=======================================
Files 827 827
Lines 15133 15133
Branches 4357 4365 +8
=======================================
Hits 14942 14942
Misses 184 184
Partials 7 7
Continue to review full report in Codecov by Harness.
|
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #3997 +/- ##
=======================================
Coverage 98.73% 98.73%
=======================================
Files 827 827
Lines 15133 15133
Branches 4357 4357
=======================================
Hits 14942 14942
Misses 184 184
Partials 7 7
Continue to review full report in Codecov by Sentry.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #3997 +/- ##
=======================================
Coverage 98.73% 98.73%
=======================================
Files 827 827
Lines 15133 15133
Branches 4357 4357
=======================================
Hits 14942 14942
Misses 184 184
Partials 7 7
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
✅ Deploy preview for gazebo ready!Previews expire after 1 month automatically.
|
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #3997 +/- ##
=======================================
Coverage 98.73% 98.73%
=======================================
Files 827 827
Lines 15133 15133
Branches 4357 4357
=======================================
Hits 14942 14942
Misses 184 184
Partials 7 7
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Description
This PR addresses a
GraphQLError: Cannot query field 'message' on type 'CreateUserTokenError'that occurs when attempting to query themessagefield directly on theCreateUserTokenErrorunion type.The root cause is that
CreateUserTokenErroris a GraphQL union (UnauthenticatedError | ValidationError), and fields cannot be queried directly on union types. All member types of this union, however, implement theResolverErrorinterface, which exposes themessagefield.Code Example
Notable Changes
The fix updates the
createUserTokenmutation query insrc/services/access/useGenerateUserToken.tsto use an inline fragment... on ResolverError { message }. This correctly retrieves the error message when an error occurs, resolving the GraphQL validation error and aligning the frontend query with the backend schema. It also ensures that the existing Zod schema, which expects amessagefield, is correctly populated.Screenshots
Link to Sample Entry
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.
Fixes API-E9F